package com.jsgt.greekfire.ui.coin.adapter

import android.content.Context
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.jsgt.greekfire.R
import com.jsgt.greekfire.ui.coin.CoinBean

class CoinAdapter(
    context: Context,
    layoutId: Int,
    data: MutableList<CoinBean>? = null
) : BaseQuickAdapter<CoinBean, BaseViewHolder>(layoutId, data) {
    override fun convert(helper: BaseViewHolder, item: CoinBean) {
        item?.let {
            helper.setText(R.id.tvName, item?.name)
                .setText(R.id.tvTransactionRate,context.resources.getString(R.string.coinList_text2)+item?.transactionRate)
                .setText(R.id.tvTransaction,context.resources.getString(R.string.coinList_text2)+item?.transaction)
                .setText(R.id.tvNum, context.resources.getString(R.string.coinList_text3)+item?.num+"/USDT")
                .setText(R.id.tvLimit, context.resources.getString(R.string.coinList_text4)+item?.limit+"/CNY")
                .setText(R.id.tvCurrentPrices, "¥"+item?.currentPrices)
                .setText(R.id.tvCurrent, "/USDT")
            if (item?.weChat.equals("1")) {
                helper.setGone(R.id.ivWechat, false)
            } else {
                helper.setGone(R.id.ivWechat, true)
            }
            if (item?.alipay.equals("1")) {
                helper.setGone(R.id.ivAlipay, false)
            } else {
                helper.setGone(R.id.ivAlipay, true)
            }
        }
    }

}